package com.localjoycommunity.cpdj.project.system.service.impl;

import com.localjoycommunity.cpdj.project.system.domain.WishList;
import com.localjoycommunity.cpdj.project.system.domain.vo.UserWishListVo;
import com.localjoycommunity.cpdj.project.system.mapper.WishListMapper;
import com.localjoycommunity.cpdj.project.system.service.IWishListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 心愿列Service业务层处理
 *
 * @author aqie
 * @date 2020-11-29
 */
@Service
public class WishListServiceImpl implements IWishListService
{
    @Autowired
    private WishListMapper wishListMapper;

    /**
     * 查询心愿列
     *
     * @param id 心愿列ID
     * @return 心愿列
     */
    @Override
    public WishList selectWishListById(Long id)
    {
        return wishListMapper.selectWishListById(id);
    }

    /**
     * 查询心愿列列表
     *
     * @param wishList 心愿列
     * @return 心愿列
     */
    @Override
    public List<WishList> selectWishListList(WishList wishList)
    {
        return wishListMapper.selectWishListList(wishList);
    }

    /**
     * 新增心愿列
     *
     * @param wishList 心愿列
     * @return 结果
     */
    @Override
    public int insertWishList(WishList wishList)
    {
        return wishListMapper.insertWishList(wishList);
    }

    /**
     * 修改心愿列
     *
     * @param wishList 心愿列
     * @return 结果
     */
    @Override
    public int updateWishList(WishList wishList)
    {
        return wishListMapper.updateWishList(wishList);
    }

    /**
     * 批量删除心愿列
     *
     * @param ids 需要删除的心愿列ID
     * @return 结果
     */
    @Override
    public int deleteWishListByIds(Long[] ids)
    {
        return wishListMapper.deleteWishListByIds(ids);
    }

    /**
     * 删除心愿列信息
     *
     * @param id 心愿列ID
     * @return 结果
     */
    @Override
    public int deleteWishListById(Long id)
    {
        return wishListMapper.deleteWishListById(id);
    }

    @Override
    public List<UserWishListVo> userWishList(int userId, int bool) {
        if(bool == 1){
            return wishListMapper.userWishList(userId);
        } else {
            return wishListMapper.userWishListFinish(userId);
        }

    }
}
